package com.itheima.controller;

import com.itheima.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class UserController {

    @RequestMapping("/save")
    @ResponseBody
    public String save(String name){
        System.out.println(name);
        return "123";
    }

    @RequestMapping("/user")
    @ResponseBody
    public String use(User user){
        System.out.println(user);
        return null;
    }


    @RequestMapping("/listad")
    @ResponseBody
    public String listad(@RequestParam List<String> likes){
        System.out.println(likes);
        return null;
    }

    @RequestMapping("/asd")
    @ResponseBody
    public String ads(){
        System.out.println(111);
        return "456";
    }

    @RequestMapping("/jdbc")
    @ResponseBody
    public User qwe(@RequestBody User user){
        user.setUsername("lisi");
        return user;
    }
}
